<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>检测可打印的字符是不是不包含空白、数字和字母</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.ctype-punct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ctype_punct</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">ctype_punct</span> &mdash; <span class="dc-title">
   检测可打印的字符是不是不包含空白、数字和字母
  </span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.ctype-punct-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ctype_punct</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$text</code></span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   检查提供的 <span class="type"><a href="language.types.string.html" class="type string">string</a></span> 和 <code class="parameter">text</code> 里面的字符是不是都是标点符号。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ctype-punct-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">text</code></dt>

     <dd>

      <p class="para">
        需要被测试的字符串。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ctype-punct-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
      如果在 <code class="parameter">text</code> 里面的每个字符都是能打印的，但不是字母、数字，也不是空白，那么就返回 <strong><code>TRUE</code></strong> ；反之则返回 <strong><code>FALSE</code></strong> 。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ctype-punct-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-6168">
    <p><strong>Example #1 一个 <span class="function"><strong>ctype_punct()</strong></span> 的例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$strings&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">'ABasdk!@!$#'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'!@&nbsp;#&nbsp;$'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'*&amp;$()'</span><span style="color: #007700">);<br />foreach&nbsp;(</span><span style="color: #0000BB">$strings&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$testcase</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">ctype_punct</span><span style="color: #007700">(</span><span style="color: #0000BB">$testcase</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"The&nbsp;string&nbsp;</span><span style="color: #0000BB">$testcase</span><span style="color: #DD0000">&nbsp;consists&nbsp;of&nbsp;all&nbsp;punctuation.\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"The&nbsp;string&nbsp;</span><span style="color: #0000BB">$testcase</span><span style="color: #DD0000">&nbsp;does&nbsp;not&nbsp;consist&nbsp;of&nbsp;all&nbsp;punctuation.\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
The string ABasdk!@!$# does not consist of all punctuation.
The string !@ # $ does not consist of all punctuation.
The string *&amp;$() consists of all punctuation.
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.ctype-punct-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para">
如果给出一个 -128 到 255 之间(含)的整数, 将会被解释为该值对应的ASCII字符 (负值将加上 256 以支持扩展ASCII字符).
其它整数将会被解释为该值对应的十进制字符串.</p></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ctype-punct-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="ctype_cntrl.html" class="function" rel="rdfs-seeAlso">ctype_cntrl()</a> - 做控制字符检测</span></li>
    <li class="member"><span class="function"><a href="ctype_graph.html" class="function" rel="rdfs-seeAlso">ctype_graph()</a> - 做可打印字符串检测，空格除外</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>